package 二叉树;


import java.util.ArrayList;
import java.util.List;

/**
 * https://leetcode.cn/problems/binary-tree-inorder-traversal/description/?envType=study-plan-v2&envId=top-100-liked
 */
public class _94_二叉树的中序遍历 {

    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> result = new ArrayList<>();
        inorderTraversal(root,result);
        return result;
    }

    private void inorderTraversal(TreeNode node,List<Integer> result) {
        if(node == null) return;
        inorderTraversal(node.left,result);
        result.add(node.val);
        inorderTraversal(node.right,result);
    }


}